package org.moonlight.jvm.natives.java.lang.object;

import org.moonlight.jvm.natives.AbstractNativeMethod;
import org.moonlight.jvm.rtda.exclusive.Frame;
import org.moonlight.jvm.rtda.share.Object;

/**
 * 本地方法 getClass()
 *
 * @author Moonlight
 * @createTime 2023/9/20 17:44
 **/
public class GetClass extends AbstractNativeMethod {

    public GetClass() {
        super(JAVA_LANG_OBJECT, "getClass", "()Ljava/lang/Class;");
    }

    @Override
    public void nativeMethod(Frame frame) {
        Object that = frame.getLocalVars().getThis();
        Object jClass = that.getClazz().getJClass();
        frame.getOperandStack().pushRef(jClass);
    }

}
